package ord2.crawler;

import java.io.File;
import java.net.URL;

/**
 * Used to listen operation that occurs in some crawler. There are two kinds of
 * operations. Operation that occurs in starting or stoping a crawler or operations
 * that occurs in starting and stoping a download content.
 *
 * @author José Ivan
 * @author Edviges
 * 
 */
public interface CrawlerListener {

    /**
     * Receives a operation (start or stop) that occured in some crawler.
     * Operation type is localized in <code>CrawlerConstants</code>
     * @see CrawlerConstants
     * @param type Type of this operation
     * @param crawler Crawler that sent the action
     */
    void operationAction(int type, Crawler crawler);

    /**
     * Receives a operation (start or stop) that occured in some URL.
     * Operation type is localized in <code>CrawlerConstants</code>
     * @param type Type of this operation
     * @param crawler Crawler that sent the action
     * @param url Content URL
     */
    void urlAction(int type, Crawler crawler, URL url);

    /**
     * Receives a document action. Same URL can retrieve many documents.
     * Each document sends a event.
     * @param crawler Crawler that sent event.
     * @param document Path where document was stored.
     */
    void documentAction(Crawler crawler, File document);
}
